class Cycle < ActiveRecord::Base
  before_validation :save_image
  attr_accessor :image
  validates_presence_of :img,:link,:sort
  protected
  def save_image
    unless @image.blank?
      self.img=CommonFunction.upload_file(@image,"/public/images/newsimgs/")     
    end
  end
end
